package com.jtlrm.ckd.util.ContactList;

import android.content.Context;
import android.util.AttributeSet;

import com.jtlrm.ckd.entity.ShiWuSelectEntity;
import com.jtlrm.ckd.entity.YinShiDetailAdpterEntity;

import java.util.ArrayList;
import java.util.List;

public class FoodListView extends ContactListView {

    public FoodListView(Context context) {
        super(context);
    }

    public FoodListView(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public FoodListView(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }


    public void init(List<SlideBarEntity> contactList, List<ShiWuSelectEntity> adapterData, int type, YinShiDetailAdpterEntity yinShiDetailEntity) {
        InitialLetterUitl.sortList(contactList);
        this.contactList = contactList;
        adapter = new ShiWuSelectAdapter(context, 0, new ArrayList<>(contactList), adapterData, type, yinShiDetailEntity);
        adapter.setPrimaryColor(primaryColor).setPrimarySize(primarySize).setInitialLetterBg(initialLetterBg)
                .setInitialLetterColor(initialLetterColor);
        listView.setAdapter(adapter);
        if (showSiderBar) {
            sidebar.setListView(listView);
        }
    }

    public ShiWuSelectAdapter getAdapter() {
        if (adapter != null) {
            return (ShiWuSelectAdapter) adapter;
        }
        return null;
    }
}

